<?php
$v_year=date("Y");
if(isset($_REQUEST['year'])){
	$v_year=$_REQUEST['year'];
}
$v_month= date("m");
if(isset($_REQUEST['month'])){
	$v_month=$_REQUEST['month'];
}
$v_status=2;
if(isset($_REQUEST['status'])){
	$v_status=$_REQUEST['status'];
}
$v_offset=1;
if(isset($_REQUEST['offset'])){
	$v_offset=$_REQUEST['offset'];
}
$page=1;
if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}

$v_limit = CONST_LIMIT_QA_PER_PAGE;
if(_is_sqlserver()){
	// Lay so luong tthc co trong co quan hanh chinh
	$cmd = @mssql_init("Onegate_QAGetAllByTime", $conn);
	@mssql_bind($cmd, "@p_year",$v_year, SQLINT4);
	@mssql_bind($cmd, "@p_month",$v_month, SQLINT4);
	@mssql_bind($cmd, "@p_status",$v_status, SQLINT4);
	$result = @mssql_execute($cmd);
	$arr_count = _get_row_to_array($result);
	@mssql_free_result($result);
	$v_total =sizeof($arr_count);
	$pager  = Pager::getPagerData($v_total, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;
	$cmd = @mssql_init("Onegate_QAGetByTime", $conn);
	@mssql_bind($cmd, "@p_year",$v_year, SQLINT4);
	@mssql_bind($cmd, "@p_month",$v_month, SQLINT4);
	@mssql_bind($cmd, "@p_status",$v_status, SQLINT4);
	@mssql_bind($cmd,"@offset", $offset,SQLINT4);	
	@mssql_bind($cmd,"@limit",$limit,SQLINT4);
	$result = @mssql_execute($cmd);
	$arr_qa = _get_row_to_array($result);
	@mssql_free_result($result);
}
?>